@<template>
  <div class="toast2" v-show='isShow'>
      <div>{{message}}</div>
  </div>
</template>

<script>
export default {
    data() {
        return {
            message: '',
            isShow: false,
        }
    },
    methods: {
        show(msg,delay=1500) {
            this.isShow = true;
            this.message = msg;
            setTimeout(() => {
                this.isShow = false;
                this.message = ''
            },delay)
        }
    }
}
</script>

<style>
.toast2 {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);
    background-color: pink;
    padding: 10px 20px;
    color: #fff;
    z-index: 999;
}

</style>